﻿// Decompiled with JetBrains decompiler
// Type: UnityEngine.tvOS.Device
// Assembly: UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: E6AE6B5A-2752-4B07-9528-C8B77C62CE79
// Assembly location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.dll
// XML documentation location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.xml

using System.Runtime.CompilerServices;
using UnityEngine.Bindings;

#nullable disable
namespace UnityEngine.tvOS
{
  /// <summary>
  ///   <para>Interface into tvOS specific functionality.</para>
  /// </summary>
  [NativeHeader("PlatformDependent/iPhonePlayer/IOSScriptBindings.h")]
  public sealed class Device
  {
    private static extern string tvOSsystemVersion { [FreeFunction("systeminfo::GetDeviceSystemVersion"), NativeConditional("PLATFORM_TVOS"), MethodImpl(MethodImplOptions.InternalCall)] get; }

    /// <summary>
    ///   <para>tvOS version.</para>
    /// </summary>
    public static string systemVersion => Device.tvOSsystemVersion;

    private static extern DeviceGeneration tvOSGeneration { [NativeConditional("PLATFORM_TVOS"), FreeFunction("UnityDeviceGeneration"), MethodImpl(MethodImplOptions.InternalCall)] get; }

    /// <summary>
    ///   <para>The generation of the device. (Read Only)</para>
    /// </summary>
    public static DeviceGeneration generation => Device.tvOSGeneration;

    private static extern string tvOSVendorIdentifier { [NativeConditional("PLATFORM_TVOS"), FreeFunction("UnityVendorIdentifier"), MethodImpl(MethodImplOptions.InternalCall)] get; }

    /// <summary>
    ///   <para>Vendor ID.</para>
    /// </summary>
    public static string vendorIdentifier => Device.tvOSVendorIdentifier;

    [FreeFunction("UnityAdIdentifier")]
    [NativeConditional("PLATFORM_TVOS")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern string GetTVOSAdIdentifier();

    /// <summary>
    ///   <para>Advertising ID.</para>
    /// </summary>
    public static string advertisingIdentifier
    {
      get
      {
        string tvosAdIdentifier = Device.GetTVOSAdIdentifier();
        Application.InvokeOnAdvertisingIdentifierCallback(tvosAdIdentifier, Device.IsTVOSAdTrackingEnabled());
        return tvosAdIdentifier;
      }
    }

    [FreeFunction("IOSScripting::IsAdTrackingEnabled")]
    [NativeConditional("PLATFORM_TVOS")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern bool IsTVOSAdTrackingEnabled();

    /// <summary>
    ///   <para>Is advertising tracking enabled.</para>
    /// </summary>
    public static bool advertisingTrackingEnabled => Device.IsTVOSAdTrackingEnabled();

    [NativeConditional("PLATFORM_TVOS")]
    [NativeMethod(Name = "IOSScripting::SetNoBackupFlag", IsFreeFunction = true, IsThreadSafe = true)]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void SettvOSNoBackupFlag(string path);

    /// <summary>
    ///   <para>Set file flag to be excluded from iCloud/iTunes backup.</para>
    /// </summary>
    /// <param name="path"></param>
    public static void SetNoBackupFlag(string path) => Device.SettvOSNoBackupFlag(path);

    [NativeMethod(Name = "IOSScripting::ResetNoBackupFlag", IsFreeFunction = true, IsThreadSafe = true)]
    [NativeConditional("PLATFORM_TVOS")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void tvOSResetNoBackupFlag(string path);

    /// <summary>
    ///   <para>Reset "no backup" file flag: file will be synced with iCloud/iTunes backup and can be deleted by OS in low storage situations.</para>
    /// </summary>
    /// <param name="path"></param>
    public static void ResetNoBackupFlag(string path) => Device.tvOSResetNoBackupFlag(path);
  }
}
